package com.baturu.vin.hyundai.dal.dao;

import com.baturu.vin.hyundai.dto.HyundaiKiaPartsMappingDTO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Collection;
import java.util.List;


public interface HyundaiKiaPartsMappingDAO {

    @Select({"<script>select parts_id, dir_list, btr_parts_name partsName" ,
            "from hyundaikia_parts_mapping_v2 where dir_list = #{bpno} and btr_parts_name in " ,
            "<foreach item='item' index='index' collection='btrPartsNames' open='(' separator=',' close=')'>",
            "#{item}",
            "</foreach>",
            "</script>"})
    List<HyundaiKiaPartsMappingDTO> queryByBtrPartsName(@Param("bpno") String bpno, @Param("btrPartsNames") Collection<String> btrPartsNames);

    @Select({"<script>select parts_id, dir_list, btr_parts_name partsName" ,
            "from hyundaikia_parts_mapping_v2 where dir_list = #{bpno} and parts_id in " ,
            "<foreach item='item' index='index' collection='parts_ids' open='(' separator=',' close=')'>",
            "#{item}",
            "</foreach>",
            "</script>"})
    List<HyundaiKiaPartsMappingDTO> queryByParts_id(@Param("bpno") String bpno, @Param("parts_ids") Collection<String> parts_ids);

    @Select({"<script>select parts_id partsId, btr_Parts_Name as partsName " ,
            "from hyundaikia_parts_mapping_v2 where dir_list = #{bpno} and parts_id in " ,
            "<foreach item='item' index='index' collection='partsCodes' open='(' separator=',' close=')'>",
            "#{item}",
            "</foreach>",
            "</script>"})
    List<HyundaiKiaPartsMappingDTO> queryByPartsCode(@Param("bpno") String bpno, @Param("partsCodes") Collection<String> partsCodes);
}
